import React, { Component } from 'react'
//import qs from 'querystring'

export default class Detail extends Component {

  data=[
    {id:'01',msg:'你好中国'},
    {id:'02',msg:'你好深圳'},
    {id:'03',msg:'你好未来的自己'}
  ]

  render() {
    /* params参数处理 */
    // const { id,msg } = this.props.match.params
    // const content=this.data.find(i=>i.id===id).msg

    /* search参数处理 */
    // const { id,msg }= qs.parse(this.props.location.search.slice(1))
    // const content=this.data.find(i=>i.id===id).msg

    /* state参数处理 */
    const { id,msg } = this.props.location.state
    const content=this.data.find(i=>i.id===id).msg

    return (
      <ul>
        <li>ID:{id}</li>
        <li>TITLE:{msg}</li>
        <li>CONTENT:{content}</li>
      </ul>
    )
  }
}
